import React from 'react'
import {
  autorun,
  observable,
  getObservableMaker,
} from '@formily/reactive'

const observableAnnotation = getObservableMaker(observable)

const target = {
  t1: 1,
}

const targetProxy = observableAnnotation({ value: target })

const target2 = {
  t2: 2,
}

const target2Proxy = observableAnnotation({ value: target2 })

const comp = observable.computed(() => {
  return target2Proxy.t2
})

autorun(() => {
  console.log('autorun: ', targetProxy.t1)
  console.log('autorun: ', targetProxy.t1b)
  console.log('compute: ', comp.value)
})

// setTimeout(() => {
//   targetProxy.a = '123'
// }, 2000)

export default () => <div>observable-test</div>
